﻿using Net5ApiANdWpfClient.Lib.Model.SystemAdmin;
using Net5ApiANdWpfClient.Lib.Service;
using Net5ApiANdWpfClient.WpfClient.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using WPF.MDI;

namespace Net5ApiANdWpfClient.WpfClient
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : BaseWindow
    {
        public MainWindow()
        {
            InitializeComponent();
            this.SystemMenu.ItemsSource = ModuleService.MenuList;
            this.WindowState = WindowState.Maximized;

        }
        private void SystemMenu_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            //获取点击的菜单文本对象
            TextBlock textBlock = sender as TextBlock;
            ModuleView view = textBlock.Tag as ModuleView;
            if (!string.IsNullOrEmpty(view.winform_type))
            {
              //  string typeStr = view.winform_type.Replace(".WinForm.", ".WpfDemo.");
                Type type = Type.GetType(view.winform_type);
                WindowsManager.MdiWindowShowChildShow(type,MainMdiWindow, view.module_name);
            }
        }
    }
}
